//
//  MoreViewController.m
//  FKGW
//
//  Created by song ce on 2017/2/20.
//  Copyright © 2017年 song ce. All rights reserved.
//

#import "MoreViewController.h"
#import "MoreCollection.h"
@interface MoreViewController ()
@property (weak, nonatomic) IBOutlet UILabel *topView;
@property(nonatomic,strong)MoreCollection *furniture;
@property(nonatomic,strong)NSMutableArray *dataSource;
@end
@implementation MoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.dataSource  = [NSMutableArray array];
    MoreCollection *furniture = [[MoreCollection alloc]initWithFrame:CGRectMake(0, kNaviBarHeight, Main_Screen_Width, Main_Screen_Height-kNaviBarHeight)];
    [self.view addSubview:furniture];
    self.furniture = furniture;
//    [self searchButton];
     [self loadData];
    if(!ISNOTNEEDMESSAGEBTN){
        self.isNeedMessageItem = YES;
    }
}
-(void)loadData{
    //2.17,查看更多行业接口
    NSDictionary *paraDic = @{
                               @"word":@""
                               };
    __weak typeof(self)  weakSelf = self;
    [Tools AFNetworkingRequestTypePostWithUrl:GETMORETRADE paramters:paraDic  afterResultBlock:^(NSDictionary *resultDic) {
        DLog(@"查看更多行业接口 ----%@",resultDic);
        if([resultDic[@"flag"] isEqualToString:@"true"]){
            NSArray *data = resultDic[@"data"];
            if([data isKindOfClass:[NSNull class]]) return ;
            for(NSDictionary *dic in data){
                MoreGroup *group = [[MoreGroup alloc]init];
                group.tradeName = dic[@"tradeName"];
                group.ishaveIcon = YES;
                group.url = dic[@"url"];
                NSMutableArray *contentArr = [NSMutableArray array];
                NSArray *contents = dic[@"contents"];
                for(NSDictionary *cDic in contents){
                    MoreModel *model = [[MoreModel alloc]init];
                    model.name = cDic[@"name"];
                    model.id = cDic[@"id"];
                    [contentArr addObject:model];
                }
                group.contents = contentArr;
                [weakSelf.dataSource addObject:group];
            }
            weakSelf.furniture.dataSoure = weakSelf.dataSource;
        }else{
            if(resultDic[@"errorString"]){
                [MBProgressHUD showTipMessageInWindow:resultDic[@"errorString"]];
            }
        }
    }];
}
-(void)searchButton{
    if(!ISNOTNEEDMESSAGEBTN){
        self.isNeedMessageItem = YES;
    }

    
    UIButton *locationButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
    locationButton2.frame=CGRectMake(0, 0, 40, 40);
    [locationButton2 setImage:[UIImage imageNamed:@"nav_icon_sousuo_nor"] forState:UIControlStateNormal];
    [locationButton2 addTarget:self action:@selector(right2Action) forControlEvents:UIControlEventTouchUpInside];
    self.rightItem2 = locationButton2;
}

-(void)right1Action{
    
    
    
}

-(void)right2Action{
    
    
    
}

@end
